﻿using System;
using System.Windows.Data;

namespace CDC.SampleShell.Applications.Converters
{
    public sealed class TabDisplayConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string actualView = value.ToString();
            string currentView = parameter.ToString();

            if (String.IsNullOrEmpty(actualView))
            {
                return System.Windows.Visibility.Collapsed;
            }
            else
            {
                if (actualView.Equals(currentView, StringComparison.OrdinalIgnoreCase))
                {
                    return System.Windows.Visibility.Visible;
                }
                else
                {
                    return System.Windows.Visibility.Collapsed;
                }
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
